﻿using System;

namespace _10_ExtendDemo
{
    class Shape
    {
        protected float length;
        protected float width;

        public Shape()
        {
            Console.WriteLine("Shape created");
        }
        public Shape(float length, float width)
        {
            this.length = length;
            this.width = width;
            Console.WriteLine("Shape created");
        }

        public void SetLength(float length)
        {
            this.length = length;    
        }
        public void SetWidth(float width)
        {
            this.width = width;
        }
    }

    class Rectangle : Shape
    {
        public float GetArea()
        {
            return length * width;
        }
    }

    internal class Program
    {
        static void Main(string[] args)
        {
            Rectangle rect = new Rectangle();
            rect.SetLength(10.5f);
            rect.SetWidth(8.8f);
            Console.WriteLine("面积为：{0}", rect.GetArea());
        }
    }
}
